package com.xinyu.controller;


import com.xinyu.domain.Operation;
import com.xinyu.domain.Words;
import com.xinyu.service.IOperationService;
import com.xinyu.vo.BaseResult;
import com.xinyu.vo.OperationRequest;
import com.xinyu.vo.WordsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author l
 * @since 2025-02-20
 */
@RestController
@RequestMapping("/operation")
public class OperationController {

    @Autowired
    private IOperationService operationService;

    @PostMapping("queryByPage")
    public ResponseEntity<BaseResult> queryByPage(@RequestBody OperationRequest operationRequest){
        BaseResult br = operationService.queryByPage(operationRequest);
        return ResponseEntity.ok(br);
    }


    @PostMapping("/save")
    public ResponseEntity<BaseResult> save(@RequestBody Operation operation) {
        operationService.save(operation);
        return ResponseEntity.ok(BaseResult.ok());
    }

}

